#!/bin/csh -f
set EXEC=$DECAHOME/bin/multi_
set FNAME="tiling.inp"
set MULTI=2
set ok=0
if ($# == 0) then
    echo 'Usage: "multi INPUT_TILING [MULTI] [OUTPUT_TILING]".'
    exit
endif
if !(-e $1) then
    echo "First argument must be filename INPUT_TILING."
    exit
endif
set FINP=$1
shift
# will end with error statement @: expression syntax if $1 is not number
if ($# > 0) then
    @ MULTI=$1
    shift
endif
if ( $# > 0 ) set FNAME=$1
if ( -e $FNAME ) then
    echo -n "Tiling $3 already exists. Overwrite [y/n]? "
    set yesno=$<
    if ($yesno == "n") then
	echo "Nothing done."
	exit
    endif
endif
awk 'BEGIN{print ARGV[2];ARGC-=1}{print}' $FINP $MULTI | $EXEC > $FNAME
awk -f $DECAHOME/SRC/tico.awk $FNAME
##

